package com.xjl.controller;

import com.xjl.domain.User;
import org.springframework.web.bind.annotation.*;

@RestController
public class HelloController {
    @RequestMapping("/hello")
    public String hello(){
        return "hello world";
    }

    @RequestMapping("/testMethod")
    public String testMethod(){
        System.out.println("testMethod处理了请求");
        return "testMethod";
    }

    @RestController
    @RequestMapping("/test")
    public class TestController {
        @RequestMapping(value = "/testParams",method = RequestMethod.GET,params = "code")
        public String testParams(){
            System.out.println("testParams处理了请求");
            return "testParams";
        }
    }


    @RequestMapping(value = "/testHeaders",method = RequestMethod.GET,headers = "deviceType!=ios")
    public String testHeaders(){
        System.out.println("testHeaders处理了请求");
        return "testHeaders";
    }


    @GetMapping(value = "/user/{id}")
    public String findUserById( @PathVariable("id")Integer id){
        System.out.println("findUserById");
        System.out.println(id);
        return "findUserById";
    }
}

